/*
 * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 *   - Neither the name of Oracle or the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */ 


/*
 * GridBagLayoutDemo.java requires no other files.
 */

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;

public class GridBagLayoutDemo extends JPanel implements ActionListener {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	final static boolean shouldFill = true;
    final static boolean shouldWeightX = true;
    final static boolean RIGHT_TO_LEFT = false;
    protected JButton b1;
	protected static JLabel l1,l2;
	protected JButton b3;
	private static JLayeredPane lp1;

    public static void addComponentsToPane(Container pane) {
    	ImageIcon leftButtonIcon = new ImageIcon("/Users/taia/Desktop/imgs/left.jpg");
    	ImageIcon vorImg = new ImageIcon("/Users/taia/Desktop/imgs/vor.png");
    	ImageIcon minusImg = new ImageIcon("/Users/taia/Desktop/imgs/minus.jpg");
    	ImageIcon plusImg = new ImageIcon("/Users/taia/Desktop/imgs/plus.jpg");
    	ImageIcon arrowImg = new ImageIcon("/Users/taia/Desktop/imgs/arrow.png");
    	
        if (RIGHT_TO_LEFT) {
            pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        }

        JButton button;
	pane.setLayout(new GridBagLayout());
	pane.setBackground(Color.WHITE);
	GridBagConstraints c = new GridBagConstraints();
	if (shouldFill) {
	//natural height, maximum width
	c.fill = GridBagConstraints.HORIZONTAL;
	}

	button = new JButton(minusImg);
	button.setBackground(Color.WHITE);
	
	if (shouldWeightX) {
	c.weightx = 0.5;
	}
	
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 0;
	pane.add(button, c);
	/*
	button = new JButton("RESET");
	button.setBackground(Color.WHITE);
	c.fill = GridBagConstraints.HORIZONTAL;
	c.weightx = 0.5;
	c.gridx = 1;
	c.gridy = 0;
	pane.add(button, c);
	*/

	button = new JButton(plusImg);
	button.setBackground(Color.WHITE);
	c.fill = GridBagConstraints.HORIZONTAL;
	c.weightx = 0.5;
	
	c.gridx = 2;
	c.gridy = 0;
	pane.add(button, c);

	button = new JButton("Long-Named Button 4");
	button.setBackground(Color.WHITE);
	c.fill = GridBagConstraints.HORIZONTAL;
	c.ipady = 40;      //make this component tall
	c.weightx = 0.0;
	c.gridwidth = 3;
	c.gridx = 0;
	c.gridy = 2;
	
	c.anchor = GridBagConstraints.PAGE_END; //bottom of space
	pane.add(button, c);

	/*button = new JButton("5");
	button.setBackground(Color.WHITE);
	c.fill = GridBagConstraints.HORIZONTAL;
	c.ipady = 0;       //reset to default
	c.weighty = 1.0;   //request any extra vertical space
	c.anchor = GridBagConstraints.PAGE_END; //bottom of space
	c.insets = new Insets(10,0,0,0);  //top padding
	c.gridx = 1;       //aligned with button 2
	c.gridwidth = 2;   //2 columns wide
	c.gridy = 2;       //third row
	pane.add(button, c);
	*/
	
	lp1 = new JLayeredPane();
	
	l2 = new JLabel(arrowImg);
	l2.setBackground(Color.WHITE);
	c.ipady = 40;
	c.gridx = 0;
	c.gridwidth = 3;
	c.anchor = GridBagConstraints.CENTER;
	c.insets = new Insets(-70,0,90,19);
	
	pane.add(l2, c);
	
	l1 = new JLabel(vorImg);
	l1.setBackground(Color.WHITE);
	c.ipady = 40;
	c.gridx = 0;
	c.gridwidth = 3;
	c.anchor = GridBagConstraints.CENTER;
	c.insets = new Insets(40,0,40,0);  //top padding
	pane.add(l1, c);
	
	
	
    }

    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     */
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("GridBagLayoutDemo");
        frame.setBackground(Color.BLACK);
        

        //Set up the content pane.
        addComponentsToPane(frame.getContentPane());

        //Display the window.
        frame.pack();
        
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
}